home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / msgboxx / msgboxex.exe / %MAINDIR% / TestMsgBoxEx.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-06-15  |  17.2 KB  |  516 lines

  1. VERSION 5.00
  2. Begin VB.Form frmTestMsgBoxEx 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Testing VBI MsgBox"
  5.    ClientHeight    =   5025
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6945
  9.    Icon            =   "TestMsgBoxEx.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    ScaleHeight     =   5025
  13.    ScaleWidth      =   6945
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.Frame fraCustomIcon 
  16.       Caption         =   "Custom Icon"
  17.       ForeColor       =   &H80000002&
  18.       Height          =   1335
  19.       Left            =   3240
  20.       TabIndex        =   30
  21.       Top             =   3240
  22.       Width           =   3615
  23.       Begin VB.OptionButton optCustomIcon 
  24.          Caption         =   "Fax"
  25.          Height          =   255
  26.          Index           =   2
  27.          Left            =   120
  28.          TabIndex        =   33
  29.          Top             =   840
  30.          Width           =   735
  31.       End
  32.       Begin VB.OptionButton optCustomIcon 
  33.          Caption         =   "Car"
  34.          Height          =   255
  35.          Index           =   1
  36.          Left            =   1560
  37.          TabIndex        =   32
  38.          Top             =   360
  39.          Width           =   735
  40.       End
  41.       Begin VB.OptionButton optCustomIcon 
  42.          Caption         =   "None"
  43.          Height          =   255
  44.          Index           =   0
  45.          Left            =   120
  46.          TabIndex        =   31
  47.          Top             =   360
  48.          Value           =   -1  'True
  49.          Width           =   735
  50.       End
  51.       Begin VB.Image ImgIcon 
  52.          Height          =   480
  53.          Index           =   2
  54.          Left            =   960
  55.          Picture         =   "TestMsgBoxEx.frx":000C
  56.          Top             =   720
  57.          Width           =   480
  58.       End
  59.       Begin VB.Image ImgIcon 
  60.          Height          =   480
  61.          Index           =   1
  62.          Left            =   2400
  63.          Picture         =   "TestMsgBoxEx.frx":0316
  64.          Top             =   240
  65.          Width           =   480
  66.       End
  67.       Begin VB.Image ImgIcon 
  68.          Height          =   360
  69.          Index           =   0
  70.          Left            =   960
  71.          Top             =   240
  72.          Width           =   480
  73.       End
  74.    End
  75.    Begin VB.Frame fraDefault 
  76.       Caption         =   "Default Button"
  77.       ForeColor       =   &H80000002&
  78.       Height          =   1455
  79.       Left            =   1920
  80.       TabIndex        =   25
  81.       Top             =   2760
  82.       Width           =   1215
  83.       Begin VB.OptionButton optDefault 
  84.          Caption         =   "Button 4"
  85.          Height          =   195
  86.          Index           =   3
  87.          Left            =   120
  88.          TabIndex        =   29
  89.          Tag             =   "768"
  90.          Top             =   1080
  91.          Width           =   975
  92.       End
  93.       Begin VB.OptionButton optDefault 
  94.          Caption         =   "Button 3"
  95.          Height          =   195
  96.          Index           =   2
  97.          Left            =   120
  98.          TabIndex        =   28
  99.          Tag             =   "512"
  100.          Top             =   840
  101.          Width           =   975
  102.       End
  103.       Begin VB.OptionButton optDefault 
  104.          Caption         =   "Button 2"
  105.          Height          =   195
  106.          Index           =   1
  107.          Left            =   120
  108.          TabIndex        =   27
  109.          Tag             =   "256"
  110.          Top             =   600
  111.          Width           =   975
  112.       End
  113.       Begin VB.OptionButton optDefault 
  114.          Caption         =   "Button 1"
  115.          Height          =   195
  116.          Index           =   0
  117.          Left            =   120
  118.          TabIndex        =   26
  119.          Tag             =   "0"
  120.          Top             =   360
  121.          Value           =   -1  'True
  122.          Width           =   975
  123.       End
  124.    End
  125.    Begin VB.Frame fraIcon 
  126.       Caption         =   "Icons"
  127.       ForeColor       =   &H80000002&
  128.       Height          =   3015
  129.       Left            =   5400
  130.       TabIndex        =   19
  131.       Top             =   120
  132.       Width           =   1455
  133.       Begin VB.CheckBox chkFlash 
  134.          Caption         =   "Flash Icon"
  135.          Height          =   255
  136.          Left            =   120
  137.          TabIndex        =   35
  138.          Top             =   1920
  139.          Width           =   1095
  140.       End
  141.       Begin VB.OptionButton optIcon 
  142.          Caption         =   "None"
  143.          Height          =   255
  144.          Index           =   4
  145.          Left            =   120
  146.          TabIndex        =   24
  147.          Tag             =   "0"
  148.          Top             =   360
  149.          Value           =   -1  'True
  150.          Width           =   1215
  151.       End
  152.       Begin VB.OptionButton optIcon 
  153.          Caption         =   "Information"
  154.          Height          =   255
  155.          Index           =   3
  156.          Left            =   120
  157.          TabIndex        =   23
  158.          Tag             =   "64"
  159.          Top             =   1320
  160.          Width           =   1215
  161.       End
  162.       Begin VB.OptionButton optIcon 
  163.          Caption         =   "Exclamation"
  164.          Height          =   255
  165.          Index           =   2
  166.          Left            =   120
  167.          TabIndex        =   22
  168.          Tag             =   "48"
  169.          Top             =   1080
  170.          Width           =   1215
  171.       End
  172.       Begin VB.OptionButton optIcon 
  173.          Caption         =   "Question"
  174.          Height          =   255
  175.          Index           =   1
  176.          Left            =   120
  177.          TabIndex        =   21
  178.          Tag             =   "32"
  179.          Top             =   840
  180.          Width           =   1215
  181.       End
  182.       Begin VB.OptionButton optIcon 
  183.          Caption         =   "Critical"
  184.          Height          =   255
  185.          Index           =   0
  186.          Left            =   120
  187.          TabIndex        =   20
  188.          Tag             =   "16"
  189.          Top             =   600
  190.          Width           =   1215
  191.       End
  192.    End
  193.    Begin VB.Frame fraColor 
  194.       Caption         =   "Forecolor"
  195.       ForeColor       =   &H80000002&
  196.       Height          =   1455
  197.       Left            =   0
  198.       TabIndex        =   10
  199.       Top             =   2760
  200.       Width           =   1815
  201.       Begin VB.OptionButton optcolor 
  202.          Caption         =   "White"
  203.          ForeColor       =   &H80000014&
  204.          Height          =   255
  205.          Index           =   5
  206.          Left            =   960
  207.          TabIndex        =   16
  208.          Top             =   840
  209.          Width           =   800
  210.       End
  211.       Begin VB.OptionButton optcolor 
  212.          Caption         =   "Purple"
  213.          ForeColor       =   &H00C000C0&
  214.          Height          =   255
  215.          Index           =   4
  216.          Left            =   960
  217.          TabIndex        =   15
  218.          Top             =   600
  219.          Width           =   800
  220.       End
  221.       Begin VB.OptionButton optcolor 
  222.          Caption         =   "Green"
  223.          ForeColor       =   &H00008000&
  224.          Height          =   255
  225.          Index           =   3
  226.          Left            =   960
  227.          TabIndex        =   14
  228.          Top             =   360
  229.          Width           =   800
  230.       End
  231.       Begin VB.OptionButton optcolor 
  232.          Caption         =   "Red"
  233.          ForeColor       =   &H000000FF&
  234.          Height          =   255
  235.          Index           =   2
  236.          Left            =   120
  237.          TabIndex        =   13
  238.          Top             =   840
  239.          Width           =   735
  240.       End
  241.       Begin VB.OptionButton optcolor 
  242.          Caption         =   "Blue"
  243.          ForeColor       =   &H00FF0000&
  244.          Height          =   255
  245.          Index           =   1
  246.          Left            =   120
  247.          TabIndex        =   12
  248.          Top             =   600
  249.          Width           =   735
  250.       End
  251.       Begin VB.OptionButton optcolor 
  252.          Caption         =   "Black"
  253.          Height          =   255
  254.          Index           =   0
  255.          Left            =   120
  256.          TabIndex        =   11
  257.          Top             =   360
  258.          Value           =   -1  'True
  259.          Width           =   735
  260.       End
  261.    End
  262.    Begin VB.Frame fraPrompt 
  263.       Caption         =   "Message"
  264.       ForeColor       =   &H80000002&
  265.       Height          =   2535
  266.       Left            =   0
  267.       TabIndex        =   9
  268.       Top             =   120
  269.       Width           =   3135
  270.       Begin VB.CheckBox chkBold 
  271.          Caption         =   "Bold Font"
  272.          Height          =   255
  273.          Left            =   120
  274.          TabIndex        =   38
  275.          Top             =   2160
  276.          Width           =   1095
  277.       End
  278.       Begin VB.TextBox txtTitle 
  279.          Height          =   375
  280.          Left            =   120
  281.          TabIndex        =   18
  282.          Text            =   "Invalid Card Number"
  283.          Top             =   240
  284.          Width           =   2895
  285.       End
  286.       Begin VB.TextBox txtPrompt 
  287.          Height          =   1335
  288.          Left            =   120
  289.          MultiLine       =   -1  'True
  290.          TabIndex        =   0
  291.          Text            =   "TestMsgBoxEx.frx":0758
  292.          Top             =   720
  293.          Width           =   2895
  294.       End
  295.    End
  296.    Begin VB.Frame fraButtons 
  297.       Caption         =   "Buttons"
  298.       ForeColor       =   &H80000002&
  299.       Height          =   3015
  300.       Left            =   3240
  301.       TabIndex        =   2
  302.       Top             =   120
  303.       Width           =   2055
  304.       Begin VB.CheckBox chkHelpButton 
  305.          Caption         =   "Help Button"
  306.          Height          =   255
  307.          Left            =   120
  308.          TabIndex        =   37
  309.          Top             =   2640
  310.          Width           =   1335
  311.       End
  312.       Begin VB.CheckBox chkActive 
  313.          Caption         =   "Active Borders"
  314.          Height          =   255
  315.          Left            =   120
  316.          TabIndex        =   36
  317.          Top             =   2280
  318.          Width           =   1575
  319.       End
  320.       Begin VB.CheckBox chkGraphicalButtons 
  321.          Caption         =   "Graphical Buttons"
  322.          Height          =   255
  323.          Left            =   120
  324.          TabIndex        =   34
  325.          Top             =   2040
  326.          Width           =   1575
  327.       End
  328.       Begin VB.OptionButton optButton 
  329.          Caption         =   "Retry / Cancel"
  330.          Height          =   255
  331.          Index           =   5
  332.          Left            =   120
  333.          TabIndex        =   8
  334.          Top             =   1560
  335.          Width           =   1880
  336.       End
  337.       Begin VB.OptionButton optButton 
  338.          Caption         =   "Yes / No"
  339.          Height          =   255
  340.          Index           =   4
  341.          Left            =   120
  342.          TabIndex        =   7
  343.          Top             =   1320
  344.          Width           =   1880
  345.       End
  346.       Begin VB.OptionButton optButton 
  347.          Caption         =   "Yes / No / Cancel"
  348.          Height          =   255
  349.          Index           =   3
  350.          Left            =   120
  351.          TabIndex        =   6
  352.          Top             =   1080
  353.          Width           =   1880
  354.       End
  355.       Begin VB.OptionButton optButton 
  356.          Caption         =   "Abort / Retry / Ignore"
  357.          Height          =   255
  358.          Index           =   2
  359.          Left            =   120
  360.          TabIndex        =   5
  361.          Top             =   840
  362.          Width           =   1880
  363.       End
  364.       Begin VB.OptionButton optButton 
  365.          Caption         =   "Ok / Cancel"
  366.          Height          =   255
  367.          Index           =   1
  368.          Left            =   120
  369.          TabIndex        =   4
  370.          Top             =   600
  371.          Width           =   1695
  372.       End
  373.       Begin VB.OptionButton optButton 
  374.          Caption         =   "Ok"
  375.          Height          =   255
  376.          Index           =   0
  377.          Left            =   120
  378.          TabIndex        =   3
  379.          Top             =   360
  380.          Value           =   -1  'True
  381.          Width           =   1095
  382.       End
  383.    End
  384.    Begin VB.CommandButton cmdTest 
  385.       Caption         =   "Test"
  386.       Height          =   495
  387.       Left            =   120
  388.       TabIndex        =   1
  389.       Top             =   4440
  390.       Width           =   1215
  391.    End
  392.    Begin VB.Label lblWeb 
  393.       Alignment       =   2  'Center
  394.       BackStyle       =   0  'Transparent
  395.       Caption         =   "http://home.tampabay.rr.com/jmiko/"
  396.       BeginProperty Font 
  397.          Name            =   "MS Sans Serif"
  398.          Size            =   9.75
  399.          Charset         =   0
  400.          Weight          =   400
  401.          Underline       =   0   'False
  402.          Italic          =   0   'False
  403.          Strikethrough   =   0   'False
  404.       EndProperty
  405.       ForeColor       =   &H00FF0000&
  406.       Height          =   255
  407.       Left            =   3240
  408.       MouseIcon       =   "TestMsgBoxEx.frx":0780
  409.       MousePointer    =   99  'Custom
  410.       TabIndex        =   39
  411.       Top             =   4680
  412.       Width           =   3615
  413.    End
  414.    Begin VB.Label lblResult 
  415.       Alignment       =   2  'Center
  416.       BeginProperty Font 
  417.          Name            =   "MS Sans Serif"
  418.          Size            =   9.75
  419.          Charset         =   0
  420.          Weight          =   400
  421.          Underline       =   0   'False
  422.          Italic          =   0   'False
  423.          Strikethrough   =   0   'False
  424.       EndProperty
  425.       Height          =   375
  426.       Left            =   1680
  427.       TabIndex        =   17
  428.       Top             =   4560
  429.       Width           =   1335
  430.    End
  431. Attribute VB_Name = "frmTestMsgBoxEx"
  432. Attribute VB_GlobalNameSpace = False
  433. Attribute VB_Creatable = False
  434. Attribute VB_PredeclaredId = True
  435. Attribute VB_Exposed = False
  436. Option Explicit
  437. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  438. Dim MsgIcon As Long
  439. Dim MsgButtons As Long
  440. Dim MsgDefButton As Long
  441. Dim MsgForeColor As Long
  442. Dim MsgCustomIcon As Variant
  443. Private Sub Form_Load()
  444.     'Default Forecolor
  445.     MsgForeColor = vbButtonText
  446. End Sub
  447. Private Sub lblWeb_Click()
  448.     Dim rc As Long
  449.     rc = ShellExecute(0&, "open", lblWeb.Caption, vbNullString, vbNullString, 1&)
  450. End Sub
  451. Private Sub optButton_Click(Index As Integer)
  452.     'Index corresponds to VbMsgBoxStyle constants
  453.     MsgButtons = Index
  454. End Sub
  455. Private Sub optcolor_Click(Index As Integer)
  456.     'Use Forecolor of selected option control
  457.     MsgForeColor = optcolor(Index).ForeColor
  458. End Sub
  459. Private Sub optCustomIcon_Click(Index As Integer)
  460.     Set MsgCustomIcon = ImgIcon(Index).Picture
  461. End Sub
  462. Private Sub optDefault_Click(Index As Integer)
  463.     Select Case Index
  464.         Case 0: MsgDefButton = vbDefaultButton1
  465.         Case 1: MsgDefButton = vbDefaultButton2
  466.         Case 2: MsgDefButton = vbDefaultButton3
  467.         Case 3: MsgDefButton = vbDefaultButton4
  468.         Case Else: MsgDefButton = vbDefaultButton1
  469.     End Select
  470. End Sub
  471. Private Sub optIcon_Click(Index As Integer)
  472.     Select Case Index
  473.         Case 0: MsgIcon = vbCritical
  474.         Case 1: MsgIcon = vbQuestion
  475.         Case 2: MsgIcon = vbExclamation
  476.         Case 3: MsgIcon = vbInformation
  477.         Case Else: MsgIcon = 0  'No Icon
  478.     End Select
  479. End Sub
  480. Private Sub cmdTest_Click()
  481.     Dim Flags As VbMsgBoxStyle
  482.     Dim Result As VbMsgBoxResult
  483.     Dim BtnStyle As vbMsgBoxExButtonStyles
  484.     'Reset label caption
  485.     lblResult.Caption = ""
  486.     'Set initial style based on VbMsgBoxStyle constants
  487.     Flags = MsgButtons + MsgIcon + MsgDefButton
  488.     'Add help button to flags if checked
  489.     If chkHelpButton.Value = vbChecked Then Flags = Flags + vbMsgBoxHelpButton
  490.     Select Case True
  491.         Case (chkGraphicalButtons.Value = vbChecked) And (chkActive.Value = vbChecked)
  492.             BtnStyle = btnActiveGraphical
  493.         Case (chkGraphicalButtons.Value = vbChecked) And (chkActive.Value = vbUnchecked)
  494.             BtnStyle = btnGraphical
  495.         Case chkActive.Value = vbChecked
  496.             BtnStyle = btnActive
  497.         Case Else
  498.             BtnStyle = btnStandard
  499.     End Select
  500.     'If help button selected then pass bogus help file
  501.     If chkHelpButton.Value = vbChecked Then
  502.         Result = MsgBoxEx(txtPrompt, Flags, txtTitle, "C:\NoHelp.hlp", 1, (chkFlash.Value = vbChecked), MsgForeColor, (chkBold.Value = vbChecked), BtnStyle, MsgCustomIcon)
  503.     Else
  504.         Result = MsgBoxEx(txtPrompt, Flags, txtTitle, , , (chkFlash.Value = vbChecked), MsgForeColor, (chkBold.Value = vbChecked), BtnStyle, MsgCustomIcon)
  505.     End If
  506.     Select Case Result
  507.         Case vbOK: lblResult = "Ok Button"
  508.         Case vbCancel: lblResult = "Cancel Button"
  509.         Case vbAbort: lblResult = "Abort Button"
  510.         Case vbRetry: lblResult = "Retry Button"
  511.         Case vbIgnore: lblResult = "Ignore Button"
  512.         Case vbYes: lblResult = "Yes Button"
  513.         Case vbNo: lblResult = "No Button"
  514.     End Select
  515. End Sub
  516.